package com.zjw.service.message;

public interface IConnectSession {

    /**
     * 发给user message
     */
    void writeMessage(Message message);


    void writeBytes(byte[] bytes);

    /**
     * 断开此连接
     */
    void disconnect();

    /**
     * 绑定连接
     */
    void connect(IConnectListener connectListener);


    void reconnect();

    /**
     * 绑定客户端监听器
     */
    interface IConnectListener {
        void onMessage(IConnectSession session, byte[] bytes);

        void onMessage(IConnectSession session, Message message);

        void onClose(IConnectSession session);

        void onConnect(IConnectSession session);

        void onError(IConnectSession session, Throwable error);
    }
}
